<template>
  <a-modal :width="700" title="领取记录">
    <g-table ref="tableRef" :auto="false" :columns="columns" :api="couponuser" :params="searchParams" />
  </a-modal>
</template>

<script setup lang="tsx">
import { couponuser } from './api';
import type { Istorecouponuser } from './record';

const props = withDefaults(defineProps<{
  id: string
}>(), {
})
watchEffect(() => {
  if (props.id) {
    searchParams.couponId = props.id
    search()
  }
})
const searchParams = reactive({
  couponId: ''
});

const { tableRef, columns, search } = useTable<Istorecouponuser>([
  { title: '用户名', dataIndex: 'nickname' },
  {
    title: "头像",
    dataIndex: "avatar",

    customRender: ({ record }) =>
      record.avatar ? <img class="img-thumbnail" src={record.avatar} /> : "",
  },
  { title: '领取时间', dataIndex: 'createTime' },
])

</script>

<style lang="scss"></style>